Skip to content

[IMP] awesomeclicker: add editor metadata in Python file#1173

Open
jupao-odoo wants to merge 6 commits intoodoo:19.0from
odoo-dev:19.0-add-editor-awesomeclicker-jupao
Open

[IMP] awesomeclicker: add editor metadata in Python file#1173
jupao-odoo wants to merge 6 commits intoodoo:19.0from
odoo-dev:19.0-add-editor-awesomeclicker-jupao

Conversation

@jupao-odoo
Copy link

Added a new line 'editor': "jupao" in the module code to indicate the editor used for this script. This helps with code clarity and consistency within the module.

Added a new line 'editor': "jupao" in the module code to
indicate the editor used for this script. This helps with
code clarity and consistency within the module.
@robodoo
Copy link

robodoo commented Feb 16, 2026

Pull request status dashboard

@ltinel ltinel self-requested a review February 16, 2026 16:14
- Initialize module structure
- Create estate.property model
- Add basic fields and attributes
- Add security access rules
- Add action and menus for UI
Add custom views for the `estate.property` model to improve user interface
and data interaction. The commit introduces:

- A list view showing key fields: name, postcode, bedrooms, living area,
  expected price, selling price, and available date.
- A form view with structured groups and a notebook for detailed information
  including description, property features, and reserved fields like active
  and state.
- A search view with filters and group-by options to easily find and categorize
  properties, including an "Available" filter for new and offer_received
  properties, and a group-by on postcode.

This improves the usability of the real estate module, replacing default
auto-generated views with tailored ones that match business requirements.

Closes task-6
Copy link

@ltinel ltinel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work :)

FYI, if you scroll to the bottom of your PR, you'll find some Runbot links, among which the ci/style check. In there, you'll find a few styling suggestions (typically incorrect use of whitespace or newlines). Could you implement those to make the check pass?

""",

'author': "Odoo",
'editor': "jupao",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this change :) I guess it was just a test?


available_from = fields.Date(
copy=False,
default=lambda self: fields.Date.today() + timedelta(days=90)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually work with relativedelta (from dateutil.relativedelta import relativedelta):

Suggested change
default=lambda self: fields.Date.today() + timedelta(days=90)
default=lambda self: fields.Date.today() + relativedelta(months=3)

<field name="arch" type="xml">
<search string="Property">

<field name="name" string="Title"/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of overriding the string here (which is fine, by the way), you could also set it directly in the model (in the py file).

Comment on lines +5 to +11
'summary': """
Starting module for "Master the Odoo web framework, chapter 1: Build a new application"
""",

'description': """
Starting module for "Master the Odoo web framework, chapter 1: Build a new application"
""",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't seem quite right :)

Comment on lines 4 to 19
<!-- Root Menu -->
<menuitem
id="estate_menu_root"
name="Real Estate"/>

<!-- First Level -->
<menuitem
id="estate_menu_properties"
name="Properties"
parent="estate_menu_root"/>

<!-- Action Menu -->
<menuitem
id="estate_menu_properties_action"
parent="estate_menu_properties"
action="estate_property_action"/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you nest the menu items, you won't need to explicitly specify a parent anymore.

'category': 'Tutorials',
'version': '0.1',
'application': True,
'installable': True,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I believe this is the default, so you don't strictly need to specify it.

Starting module for "Master the Odoo web framework, chapter 1: Build a new application"
""",

'author': "Odoo",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, we put Odoo S.A. here, but it doesn't matter much in this context 😄

'views/estate_menus.xml'
],

'assets': {},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to remove this since it's empty.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is your own config file, so it should probably stay local :) Maybe add it to your gitignore file to avoid including it in your PRs.

Introduce estate.property.type and estate.property.tag models.
Extend estate.property with:

- Many2one relation to property type
- Many2many relation to property tags
- One2many relation to property offers

Add corresponding views and menus where required.

Fix flake8 issues to satisfy ci/style checks.
- estate.property:
  * added total_area computed field (living_area + garden_area)
  * added best_price computed field (maximum of offer prices)
  * added @onchange on 'garden' to set default garden_area=10 and garden_orientation='north'

- estate.property.offer:
  * added validity_date computed field (with inverse)
Chapter 9: link business logic to UI actions

- estate.property:
  * Add "Cancel" and "Sold" buttons in form view header.
  * Enforce state constraints: a cancelled property cannot be sold and a sold property cannot be cancelled.
  * Raise UserError when state transitions are invalid.

- estate.property.offer:
  * Add "Accept" and "Refuse" buttons.
  * Accepting an offer sets the buyer and selling price on the related property.
  * Only one offer can be accepted per property.

- Updated views to include buttons in header sections.
- Added Python methods implementing the business logic for these actions.
Copy link

@ltinel ltinel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job :)

'estate.property',
string="Property",
required=True,
ondelete='cascade'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea :) Although maybe not ideal in practice for tracking offers.

Comment on lines 23 to 26
<menuitem
id="estate_menu_type"
name="Property Type"
parent="estate_menu_root"/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this menu item (and the "Property Tags" one) should be under a "Settings" menu item. But all of this would be simpler if you use nesting instead of the "parent" field :)

Comment on lines +28 to +33
<!-- Property Type Action -->
<record id="estate_property_type_action" model="ir.actions.act_window">
<field name="name">Property Type</field>
<field name="res_model">estate.property.type</field>
<field name="view_mode">list,form</field>
</record>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actions should be in the "_views" file of the corresponding record. (same below)

<field name="expected_price"/>
<field name="selling_price"/>
<field name="available_from"/>
<field name="name" width="100px"/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to set a width, but hardcoding pixels can be risky, since users can have different screen sizes (monitor, laptop, smartphone, ...)


<group>
<group>
<field name="tag_ids" widget="many2many_tags"/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this in the oe_title div?

Comment on lines 74 to 78
<list editable="bottom">
<field name="price"/>
<field name="partner_id"/>
<field name="status"/>
</list>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this :) You can put the editable="bottom" attribute directly in the list view of the offer (in estate/views/estate_property_offer_views.xml)

Suggested change
<list editable="bottom">
<field name="price"/>
<field name="partner_id"/>
<field name="status"/>
</list>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants